//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.baidu.trace;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public final class s {
    private SharedPreferences a;
    private Map<String, String> b;
    private Set<String> c;

    public s(Context var1) {
        this.a = PreferenceManager.getDefaultSharedPreferences(var1);
        this.b = new HashMap();
        this.c = new HashSet();
    }

    public final String a(String var1) {
        if(!this.b.containsKey(var1)) {
            this.b.put(var1, this.a.getString(var1, (String)null));
        }

        return (String)this.b.get(var1);
    }

    public final void a(String var1, String var2) {
        this.b.put(var1, var2);
        if(!this.c.contains(var1)) {
            this.c.add(var1);
        }

    }

    public final void a() {
        Editor var1 = this.a.edit();
        Iterator var2 = this.c.iterator();

        while(var2.hasNext()) {
            String var3 = (String)var2.next();
            if((String)this.b.get(var3) == null) {
                var1.remove(var3);
            } else {
                var1.putString(var3, (String)this.b.get(var3));
            }
        }

        var1.apply();
        this.c.clear();
    }

    protected final void b() {
        if(this.b != null) {
            this.b.clear();
            this.b = null;
        }

        if(this.c != null) {
            this.c.clear();
            this.c = null;
        }

    }
}
